import 'package:flutter/material.dart';
import 'package:hive_storage/presentation/settings/settings_page.dart';
import 'package:hive_storage/presentation/settings/settings_viewmodel.dart';
import 'package:provider/provider.dart';

class MyApp extends StatelessWidget{
final SettingsViewmodel viewmodel;
const MyApp({super.key,required this.viewmodel});

@override
  Widget build(BuildContext context) {
  return ChangeNotifierProvider.value(value: viewmodel,
  child: Consumer<SettingsViewmodel>(
    builder: (context,viewmodel,child){
      return MaterialApp(
        debugShowCheckedModeBanner: false,
        home: const SettingsPage(),
        theme:ThemeData.light(),
        darkTheme: ThemeData.dark(),
        themeMode: viewmodel.settings.isDarkMode ? ThemeMode.dark : ThemeMode.light
      );
    },
  ),);
}
}